import { GlobalConfig } from "../../config/global/global_config";
import { Equipm } from "../entity/equipms/equipm.entity";
import { EquipmType } from "../consts/equipm_type";

export class EquipmService{

    public static ins() : EquipmService{
        if (EquipmService._ins == null){
            EquipmService._ins = new EquipmService();
        }
        return EquipmService._ins;
    }
    private static _ins = null;

    private constructor(){
            GlobalConfig.ins().equipm.map((equipm:Equipm)=>{
                if(!this.weapons[equipm.level]){
                    this.weapons[equipm.level]={};
                }
                if(!this.weapons[equipm.level][equipm.qualityType]){
                    this.weapons[equipm.level][equipm.qualityType]={};
                }

                if(!this.shields[equipm.level]){
                    this.shields[equipm.level]={};
                }
                if(!this.shields[equipm.level][equipm.qualityType]){
                    this.shields[equipm.level][equipm.qualityType]={};
                }

                switch(equipm.type){
                    case EquipmType.Weapon:
                        this.weapons[equipm.level][equipm.qualityType]=equipm;
                    break;
                    case EquipmType.Shield:
                        this.shields[equipm.level][equipm.qualityType]=equipm;
                    break;
                }
            });
    }


    shields={};
    weapons={};

    public getInitWeapon(){

    }

     
}